﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UTC_Project_Manager.Controls
{

    public partial class DispoControl : UserControl
    {
        public DispoControl()
        {
            InitializeComponent();
        }


        private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            DependencyObject dep = (DependencyObject)e.OriginalSource;

            while ((dep != null) && !(dep is DataGridCell) && !(dep is DataGridColumnHeader))
            {
                dep = VisualTreeHelper.GetParent(dep);
            }

            if (dep == null)
                return;

            if (dep is DataGridCell)
            {
                DataGridCell cell = dep as DataGridCell;
                if (!(cell.BackgroundColor = Color.LightBlue))
                {cell.BackgroundColor = Color.LightBlue;
                DispoList.Add(new int[] {cell.RowNumber , cell.ColumnNumber});}
                if (cell.BackgroundColor = Color.LightBlue)
                {cell.BackgroundColor = Color.White;
                DispoList.Remove(new int[] {cell.RowNumber , cell.ColumnNumber});}
        }

}